library(summarytools)
library(tidyverse)
## -- Attaching core tidyverse packages ------------------------ tidyverse 2.0.0 --
## v dplyr 1.1.2 v readr 2.1.4
## v forcats 1.0.0 v stringr 1.5.0
## v ggplot2 3.4.2 v tibble 3.2.1
## v lubridate 1.9.2 v tidyr 1.3.0
## v purrr 1.0.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
## x tibble::view() masks summarytools::view()
## i Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggthemes)
library(haven)
trajipaq <- read_csv("../3. Data/Trajipaq_sentiment_cr.csv")
## New names:
## Rows: 1563 Columns: 16
## -- Column specification
## -------------------------------------------------------- Delimiter: "," chr
## (12): age, education, sexe, origine, revenu, langue_mat, religion, statu... dbl
## (4): ...1, annee_qc, VD1, VI4
## i Use `spec()` to retrieve the full column specification for this data. i
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## * `` -> `...1`
reg_1 <- lm(trajipaq$VI4 ~ trajipaq$VD1 +
trajipaq$sexe +
trajipaq$age +
trajipaq$education +
trajipaq$annee_qc +
trajipaq$origine +
trajipaq$revenu +
trajipaq$langue_mat +
trajipaq$religion +
trajipaq$statut_mat
)
summary(reg_1)
##
## Call:
## lm(formula = trajipaq$VI4 ~ trajipaq$VD1 + trajipaq$sexe + trajipaq$age +
## trajipaq$education + trajipaq$annee_qc + trajipaq$origine +
## trajipaq$revenu + trajipaq$langue_mat + trajipaq$religion +
## trajipaq$statut_mat)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.40353 -0.15620 -0.05962 0.09702 0.87270
##
## Coefficients:
## Estimate Std. Error
## (Intercept) 4.084410 4.688415
## trajipaq$VD1 -0.085650 0.061682
## trajipaq$sexeHomme 0.016153 0.024146
## trajipaq$age[25;29] 0.074412 0.057887
## trajipaq$age[30;34] 0.028290 0.058402
## trajipaq$age[35;39] -0.004418 0.057437
## trajipaq$age[40;44] 0.014132 0.057552
## trajipaq$age[45;49] 0.048646 0.060129
## trajipaq$age[50;60] -0.015894 0.065013
## trajipaq$age[61;99] 0.082361 0.076391
## trajipaq$educationElementaire -0.191374 0.241597
## trajipaq$educationPost secondaire -0.094250 0.040451
## trajipaq$educationSecondaire -0.061448 0.054634
## trajipaq$educationUniversitaire -0.073848 0.030964
## trajipaq$annee_qc -0.001926 0.002330
## trajipaq$origineAmerique centrale et Amerique su Sud 0.142206 0.055703
## trajipaq$origineAsie 0.153945 0.057842
## trajipaq$origineAutres 0.014785 0.100159
## trajipaq$origineCanada 0.035056 0.145216
## trajipaq$origineCaraibes 0.165475 0.068944
## trajipaq$origineEurope -0.026851 0.053895
## trajipaq$origineFrance -0.039082 0.052542
## trajipaq$revenu[100 000 ; 149 999] -0.013619 0.053040
## trajipaq$revenu[150 000 et plus] 0.035382 0.089834
## trajipaq$revenu[20 000 ; 39 999] 0.060203 0.042913
## trajipaq$revenu[40 000 ; 59 999] 0.047042 0.042360
## trajipaq$revenu[60 000 ; 79 999] 0.022360 0.046234
## trajipaq$revenu[80 000 ; 99 999] -0.034222 0.056126
## trajipaq$langue_matAutre -0.057851 0.048068
## trajipaq$langue_matFrancais 0.028897 0.052158
## trajipaq$religionAutres Chretiens 0.079984 0.090930
## trajipaq$religionCatholique -0.089446 0.056857
## trajipaq$religionMusulmans 0.066762 0.071325
## trajipaq$religionOrthodoxe 0.098931 0.072477
## trajipaq$religionProtestante -0.017534 0.085999
## trajipaq$religionSans religion -0.055364 0.053926
## trajipaq$statut_matConjoint(e) de fait 0.020428 0.039988
## trajipaq$statut_matDivorce(e) -0.061441 0.072030
## trajipaq$statut_matMarie(e) 0.017829 0.035775
## trajipaq$statut_matSepare(e) 0.024565 0.079028
## trajipaq$statut_matVeuf(ve) -0.274459 0.246478
## t value Pr(>|t|)
## (Intercept) 0.871 0.38421
## trajipaq$VD1 -1.389 0.16578
## trajipaq$sexeHomme 0.669 0.50392
## trajipaq$age[25;29] 1.285 0.19941
## trajipaq$age[30;34] 0.484 0.62838
## trajipaq$age[35;39] -0.077 0.93873
## trajipaq$age[40;44] 0.246 0.80616
## trajipaq$age[45;49] 0.809 0.41900
## trajipaq$age[50;60] -0.244 0.80699
## trajipaq$age[61;99] 1.078 0.28165
## trajipaq$educationElementaire -0.792 0.42878
## trajipaq$educationPost secondaire -2.330 0.02033 *
## trajipaq$educationSecondaire -1.125 0.26142
## trajipaq$educationUniversitaire -2.385 0.01757 *
## trajipaq$annee_qc -0.827 0.40899
## trajipaq$origineAmerique centrale et Amerique su Sud 2.553 0.01107 *
## trajipaq$origineAsie 2.661 0.00811 **
## trajipaq$origineAutres 0.148 0.88273
## trajipaq$origineCanada 0.241 0.80937
## trajipaq$origineCaraibes 2.400 0.01687 *
## trajipaq$origineEurope -0.498 0.61862
## trajipaq$origineFrance -0.744 0.45744
## trajipaq$revenu[100 000 ; 149 999] -0.257 0.79749
## trajipaq$revenu[150 000 et plus] 0.394 0.69391
## trajipaq$revenu[20 000 ; 39 999] 1.403 0.16146
## trajipaq$revenu[40 000 ; 59 999] 1.111 0.26747
## trajipaq$revenu[60 000 ; 79 999] 0.484 0.62892
## trajipaq$revenu[80 000 ; 99 999] -0.610 0.54240
## trajipaq$langue_matAutre -1.204 0.22952
## trajipaq$langue_matFrancais 0.554 0.57989
## trajipaq$religionAutres Chretiens 0.880 0.37962
## trajipaq$religionCatholique -1.573 0.11651
## trajipaq$religionMusulmans 0.936 0.34985
## trajipaq$religionOrthodoxe 1.365 0.17306
## trajipaq$religionProtestante -0.204 0.83855
## trajipaq$religionSans religion -1.027 0.30523
## trajipaq$statut_matConjoint(e) de fait 0.511 0.60975
## trajipaq$statut_matDivorce(e) -0.853 0.39420
## trajipaq$statut_matMarie(e) 0.498 0.61853
## trajipaq$statut_matSepare(e) 0.311 0.75609
## trajipaq$statut_matVeuf(ve) -1.114 0.26619
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.2284 on 381 degrees of freedom
## (1141 observations deleted due to missingness)
## Multiple R-squared: 0.1655, Adjusted R-squared: 0.07785
## F-statistic: 1.889 on 40 and 381 DF, p-value: 0.001329
# Le modèle de régression traite les variables d'une manière inattendue.
cor.test(trajipaq$VI4, trajipaq$VD1)
##
## Pearson's product-moment correlation
##
## data: trajipaq$VI4 and trajipaq$VD1
## t = -8.1743, df = 1511, p-value = 6.232e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.2535548 -0.1570219
## sample estimates:
## cor
## -0.2057889
vis_H1 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(sexe)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination",
x = "Perception de la Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_H1)
vis_sexe <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(sexe)), aes(x = VI4, y = VD1, color = sexe)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm", formula = "y ~ x", se = FALSE) +
scale_color_brewer(name = "Sexe", palette = 1) +
labs(title = "Sentiment d'appartenance et discrimination en fonction du sexe",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_sexe)
vis_sexe_2 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(sexe)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination en fonction du sexe",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
facet_wrap(~ sexe, nrow = 2) +
theme_bw()
print(vis_sexe_2)
vis_age <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(age)), aes(x = VI4, y = VD1, color = age)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm", formula = "y ~ x", se = FALSE) +
scale_color_brewer(name = "Age", palette = 1) +
labs(title = "Sentiment d'appartenance et discrimination en fonction de l'age",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_age)
vis_age_2 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(age)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination en fonction de l'age",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
facet_wrap(~ age, nrow = 3) +
theme_bw()
print(vis_age_2)
vis_education <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(education)), aes(x = VI4, y = VD1, color = education)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm", formula = "y ~ x", se = FALSE) +
scale_color_brewer(name = "Niveau d'education", palette = 1) +
labs(title = "Sentiment d'appartenance et discrimination en fonction de l'education",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_education)
vis_education_2 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(education)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination en fonction de l'education",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
facet_wrap(~ education, nrow = 3) +
theme_bw()
print(vis_education_2)
trajipaq <-
trajipaq %>%
mutate(annee_qc_f = case_when(
annee_qc >= 1990 & annee_qc < 2000 ~ "[1990;1999]",
annee_qc >= 2000 & annee_qc < 2005 ~ "[2000;2004]",
annee_qc >= 2005 & annee_qc < 2010 ~ "[2005;2009]",
annee_qc >= 2010 & annee_qc < 2015 ~ "[2010;2014]",
annee_qc >= 2015 & annee_qc < 2020 ~ "[2015;2020]",
))
vis_annee_qc <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(annee_qc_f)), aes(x = VI4, y = VD1, color = as.factor(annee_qc_f))) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm", formula = "y ~ x", se = FALSE) +
scale_color_brewer(name = "Annee d'annee_qc au Quebec", palette = 1) +
labs(title = "Sentiment d'appartenance et discrimination en fonction de l'annee d'annee_qc",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_annee_qc)
vis_annee_qc_2 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(annee_qc_f)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination en fonction de l'annee d'annee_qc",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
facet_wrap(~ annee_qc_f, nrow = 3) +
theme_bw()
print(vis_annee_qc_2)
vis_origine <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(origine)), aes(x = VI4, y = VD1, color = origine)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm", formula = "y ~ x", se = FALSE) +
scale_color_brewer(name = "Region d'origine", palette = 1) +
labs(title = "Sentiment d'appartenance et discrimination en fonction de l'origine",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_origine)
vis_origine_2 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(origine)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination en fonction de l'origine",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
facet_wrap(~ origine, nrow = 3) +
theme_bw()
print(vis_origine_2)
vis_revenu <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(revenu)), aes(x = VI4, y = VD1, color = revenu)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm", formula = "y ~ x", se = FALSE) +
scale_color_brewer(name = "revenu", palette = 1) +
labs(title = "Sentiment d'appartenance et discrimination en fonction du revenu",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_revenu)
vis_revenu_2 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(revenu)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination en fonction du revenu",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
facet_wrap(~ revenu, nrow = 3) +
theme_bw()
print(vis_revenu_2)
vis_langue_mat <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(langue_mat)), aes(x = VI4, y = VD1, color = langue_mat)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm", formula = "y ~ x", se = FALSE) +
scale_color_brewer(name = "langue_mat maternelle", palette = 1) +
labs(title = "Sentiment d'appartenance et discrimination en fonction de la langue maternelle",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_langue_mat)
vis_langue_mat_2 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(langue_mat)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination en fonction de la langue maternelle",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
facet_wrap(~ langue_mat, nrow = 2) +
theme_bw()
print(vis_langue_mat_2)
vis_religion <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(religion)), aes(x = VI4, y = VD1, color = religion)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm", formula = "y ~ x", se = FALSE) +
scale_color_brewer(name = "religion", palette = 1) +
labs(title = "Sentiment d'appartenance et discrimination en fonction de la religion",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_religion)
vis_religion_2 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(religion)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination en fonction de la religion",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
facet_wrap(~ religion, nrow = 3) +
theme_bw()
print(vis_religion_2)
vis_statut_mat <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(statut_mat)), aes(x = VI4, y = VD1, color = statut_mat)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm", formula = "y ~ x", se = FALSE) +
scale_color_brewer(name = "Statut statut_mat", palette = 1) +
labs(title = "Sentiment d'appartenance et discrimination en fonction du statut statut_mat",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
theme_bw()
print(vis_statut_mat)
vis_statut_mat_2 <- ggplot(trajipaq %>%
filter(!is.na(VD1), !is.na(VI4), !is.na(statut_mat)), aes(x = VI4, y = VD1)) +
geom_jitter(color = "pink") +
stat_smooth(method = "lm",
formula = "y ~ x",
se = FALSE,
color = "purple") +
labs(title = "Sentiment d'appartenance et discrimination en fonction du statut statut_mat",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Quebec") +
facet_wrap(~ statut_mat, nrow = 3) +
theme_bw()
print(vis_statut_mat_2)
trajipaq <-
trajipaq %>%
mutate(VD2_n = case_when(
VD2 == "Non" ~ 0,
VD2 == "Oui" ~ 1
))
reg_2 <- glm(formula = VD2_n ~ VI4, family = "binomial", data = trajipaq)
summary(reg_2)
##
## Call:
## glm(formula = VD2_n ~ VI4, family = "binomial", data = trajipaq)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.66100 0.08359 19.871 < 2e-16 ***
## VI4 -0.73274 0.27704 -2.645 0.00817 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1379.6 on 1481 degrees of freedom
## Residual deviance: 1372.9 on 1480 degrees of freedom
## (81 observations deleted due to missingness)
## AIC: 1376.9
##
## Number of Fisher Scoring iterations: 4
cor.test(trajipaq$VD2_n, trajipaq$VI4)
##
## Pearson's product-moment correlation
##
## data: trajipaq$VD2_n and trajipaq$VI4
## t = -2.6651, df = 1480, p-value = 0.007781
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.11960874 -0.01825393
## sample estimates:
## cor
## -0.06910967
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
theme_bw()
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination en fonction du sexe",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
facet_wrap(~ sexe, nrow = 2) +
theme_bw()
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination en fonction de l'age",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
facet_wrap(~ age, nrow = 3) +
theme_bw()
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4), !is.na(education)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination en fonction de l'education",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
facet_wrap(~ education, nrow = 3) +
theme_bw()
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4), !is.na(annee_qc_f)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination en fonction de l'annee d'arivee",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
facet_wrap(~ annee_qc_f, nrow = 3) +
theme_bw()
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4), !is.na(origine)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination en fonction de l'origine",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
facet_wrap(~ origine, nrow = 3) +
theme_bw()
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4), !is.na(revenu)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination en fonction du revenu",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
facet_wrap(~ revenu, nrow = 3) +
theme_bw()
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4), !is.na(langue_mat)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination en fonction du revenu",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
facet_wrap(~ langue_mat, nrow = 2) +
theme_bw()
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4), !is.na(religion)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination en fonction de la religion",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
facet_wrap(~ religion, nrow = 3) +
theme_bw()
ggplot(trajipaq %>% filter(!is.na(VD2_n), !is.na(VI4), !is.na(statut_mat)), aes(x = VI4, y = VD2_n)) +
stat_smooth(method = "glm",
formula = "y ~ x",
color = "pink",
se = FALSE,
method.args = list(family = binomial)) +
labs(
title = "Sentiment d'appartenance et discrimination en fonction du statut statut_mat",
x = "Perception de la discrimination subie au cours des 12 derniers mois",
y = "Sentiment d'appartenance au Canada") +
facet_wrap(~ statut_mat, nrow = 3) +
theme_bw()
## Warning: glm.fit: fitted probabilities numerically 0 or 1 occurred
trajipaq <-
trajipaq %>%
mutate(VD3_n = case_when(
VD3 == "Non" ~ 0,
VD3 == "Oui" ~ 1
))
reg_3 <- glm(formula = VD3_n ~ VI4, family = "binomial", data = trajipaq)
summary(reg_3)
##
## Call:
## glm(formula = VD3_n ~ VI4, family = "binomial", data = trajipaq)
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) 1.53666 0.08143 18.872 <2e-16 ***
## VI4 -0.34851 0.28146 -1.238 0.216
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 1407.7 on 1468 degrees of freedom
## Residual deviance: 1406.2 on 1467 degrees of freedom
## (94 observations deleted due to missingness)
## AIC: 1410.2
##
## Number of Fisher Scoring iterations: 4
trajipaq <-
trajipaq %>%
mutate(VD1_f = case_when(
VD1 < 0.5 ~ "Non",
VD1 >= 0.5 ~ "Oui"
))
ctable(trajipaq$VD3, trajipaq$VD1_f)
## Cross-Tabulation, Row Proportions
## VD3 * VD1_f
## Data Frame: trajipaq
##
## ------- ------- ------------- ------------- ------------ ---------------
## VD1_f Non Oui <NA> Total
## VD3
## Non 112 (40.0%) 168 (60.0%) 0 ( 0.0%) 280 (100.0%)
## Oui 423 (34.5%) 804 (65.5%) 0 ( 0.0%) 1227 (100.0%)
## <NA> 20 (35.7%) 26 (46.4%) 10 (17.9%) 56 (100.0%)
## Total 555 (35.5%) 998 (63.9%) 10 ( 0.6%) 1563 (100.0%)
## ------- ------- ------------- ------------- ------------ ---------------
chisq.test(trajipaq$VD3, trajipaq$VD1_f)
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: trajipaq$VD3 and trajipaq$VD1_f
## X-squared = 2.8034, df = 1, p-value = 0.09406